package com.greate.community.dao;

import com.greate.community.entity.Like;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface LikeMapper {

    /**
     * 插入点赞记录
     *
     * @param like
     * @return
     */
    int insertLike(Like like);

    /**
     * 查询用户是否点赞某个实体
     *
     * @return
     */
    int countLikeByUserIdAndEntity(int userId, int entityType, int entityId);

    /**
     * 查询某个实体点赞数量
     *
     * @param entityType
     * @param entityId
     * @return
     */
    int countLikeByEntity(int entityType, int entityId);

    /**
     * 删除点赞
     *
     * @param userId
     * @param entityType
     * @param entityId
     * @return
     */
    int deleteLikeByUserIdAndEntity(int userId, int entityType, int entityId);
}
